/* eslint-disable import/prefer-default-export */
/* eslint-disable @typescript-eslint/no-explicit-any */
import $api from './index';

// 接口模板
export const Login = async (data: any) => {
  const { username, password } = data;
  console.log(username, password);
  const res = await $api.get(`/login?username=${username}&password=${password}`);
  return res;
};
// 注册
export const Reg = async (data: any) => {
  // console.log(id, data);

  const res = await $api.post('/login', data);
  return res;
};
// 用户信息
export const Limits = async () => {
  const res = await $api.get('/login');
  return res;
};
// 编辑信用户息
export const Edit = async (id: any, data: any) => {
  console.log(data);
  const res = await $api.put(`/login/${id}`, data);
  return res;
};
// 删除用户
export const Del = async (data: any) => {
  const res = await $api.delete(`/login/${data}`);
  return res;
};
// 查看轮播图carousel
export const Carousellist = async () => {
  const res = await $api.get('/carousel');
  return res;
};
// 删除轮播图
export const CarouseDel = async (data: any) => {
  const res = await $api.delete(`/carousel/${data}`);
  return res;
};
// 添加轮播图
export const Carouseadd = async (data: any) => {
  const res = await $api.post('/carousel', data);
  return res;
};
// 修改轮播图
export const Carouseedit = async (id: any, data: any) => {
  console.log(data);
  const res = await $api.put(`/carousel/${id}`, data);
  return res;
};
